﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WebApp.App.Controllers
{
    public class Channel:Controller
    {
        public void Index(int id)
        {
            Code.Cms.Channel channel = new Code.Cms.Channel();
            this.channel= channel.GetValue(id.ToString());
            #region 根据不同的频道调用不同的模板
            if (this.channel.type_id == 1)
            {
                Web.Default.Channel.ArticleAction control = new Web.Default.Channel.ArticleAction(this);                
                control.Before();
                control.Article();
                control.After();
                control.Dispose();
            }
            else if (this.channel.type_id == 2)
            {
                Web.Default.Channel.AttachmentAction control = new Web.Default.Channel.AttachmentAction(this);
                control.Before();
                control.Attachment();
                control.After();
                control.Dispose();
            }
            else if (this.channel.type_id == 3)
            {
                Web.Default.Channel.ImageAction control = new Web.Default.Channel.ImageAction(this);
                control.Before();
                control.Image();
                control.After();
                control.Dispose();
            }
            else if (this.channel.type_id == 4)
            {
                Web.Default.Channel.CommentAction control = new Web.Default.Channel.CommentAction(this);
                control.Before();
                control.Comment();
                control.After();
                control.Dispose();
            }
            #endregion
        }
        public void Article()
        {
            
        }
        public void Attachment()
        {

        }
        public void Image()
        {

        }
        public void Comment()
        {

        }
    }
}